package com.one.rope.mvp.basecore.util;

import java.io.PrintWriter;
import java.io.StringWriter;

public class ExceptionUtils {

  /**
   * 获取堆栈详细信息
   */
  public static String getStackTrace(Throwable t) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    try {
      t.printStackTrace(pw);
      return sw.toString();
    } catch (Exception e) {
      return "";
    } finally {
      try {
        sw.close();
        pw.close();
      } catch (Exception e) {
        // TODO: handle handle
      }
    }
  }
}
